<?

define('ADD','INSERT INTO `log` (`id`, `date`, `ip`, `user_agent`, `query_string`, `notes`) VALUES (NULL, now() , ?, ?, ?, ?)');
define('GET_ALL_LOGS','SELECT * FROM `log`');

class Model_Logger extends Models_Base {
	
	function log($ip, $user_agent, $query_string, $notes) {
		$sth = $this->dbh->prepare(ADD);
		$sth->execute(array($ip, $user_agent, $query_string, $notes));		
	}
	
	function getAllLogs() {
		$sth = $this->dbh->prepare(GET_ALL_LOGS);
		$sth->execute();
		
		while ($row = $sth->fetchObject()) {
			$data[] = $row;
		}		
		
		return $data;
	}
	
}